<?php if( !defined( 'MAIN_DIR' ) ) { header( 'Location: ' . dirname( PHP_SELF ) . '/' ); exit( ); }
	$readonly = ( isset( $readonly ) && $readonly == true );
	$files = ( isset( $files ) && $files ? $files : null );
	$file = ( isset( $file ) && $file ? $file : null );
		
	$max = count( $files );
	
	if( $max > 0 )	{
?>
		<table summary="List Files" width="100%" border="0" cellspacing="0" cellpadding="3">
<?
		$select = '<select style="width:45px;" onchange="setPosition( _id_, ' . $file->getIdFile( ) . ', this.value )" class="inputText">';
		for( $c = 0; $c < $max; $c ++ )
			$select .= '<option value="' . ( $c + 1 )  . '">' . sprintf( '%03d', ( $c + 1 ) ) . '</option>';
		$select .= '</select>';
		
		for( $c = 0; $c < $max; $c ++ )	{
?>
		<tr class="tableTr<?php echo ( $c % 2 ) ?>">
<?php
			if( !$readonly )	{
				if( ( $_SESSION['user']['acl'] & ACL_MODIFY )  )	{
?>
			<td width="20"><?= str_replace( array( '_id_', '"' . ( $c + 1 )  . '"' ), array( '\'' . $files[$c]->getIdFile( ) . '\'', '"' . ( $c + 1 )  . '" selected="selected"' ), $select ) ?></td>
<?php
				}
?>
<?php
				if( ( $_SESSION['user']['acl'] & ACL_DELETE )  )	{
?>
			<td width="20"><a href="#" onclick="deleteFile( <?= $files[$c]->getIdFile( ) ?>, <?= toJS( $files[$c]->getName( ) ) ?> ); return false;"><img src="images/trash.png" width="16" height="16" border="0" title="Delete" alt="Delete"/></a></td>
<?php
				}
				if( ( $_SESSION['user']['acl'] & ACL_MODIFY )  )	{
?>
			<td width="20"><a href="#" onclick="activateFile( <?= $files[$c]->getIdFile( ) ?>, <?= toJS( $files[$c]->getName( ) ) ?>, <?= ( $files[$c]->isActive( ) ? 'false' : 'true' ) ?> ); return false;"><img src="images/<?= ( $files[$c]->isActive( ) ? '' : 'no' ) ?>active.png" width="16" height="16" border="0" title="<?= ( $files[$c]->isActive( ) ? 'Hide' : 'Show' ) ?>" alt="<?= ( $files[$c]->isActive( ) ? 'Hide' : 'Show' ) ?>"/></a></td>
<?php
				}
			}
?>
			<td onclick="jumpTo( '?file_id=<?php echo $files[$c]->getIdFile( ) ?>' )"><?php echo toImage( $files[$c] )?>&nbsp;&nbsp;<?= toHTML( $files[$c]->getName( ) ) ?></td>
		</tr>
<?
		}
?>
		</table>
<?php
	}
	unset( $c, $select, $max );
?>